<html>
<head><meta charset="utf-8"><title>cargo check issue · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html">cargo check issue</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="186723540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186723540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186723540">(Jan 27 2020 at 20:43)</a>:</h4>
<p><span class="user-mention" data-user-id="212936">@Emil Lauridsen</span> I've finally reproduced the "rust analyzer is suuuper slow and runs cargo check" issue</p>



<a name="186723576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186723576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186723576">(Jan 27 2020 at 20:43)</a>:</h4>
<p>For me, it happens on the <code>stdarch</code> crate, if I hack <code>cache.rs</code></p>



<a name="186723643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186723643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186723643">(Jan 27 2020 at 20:44)</a>:</h4>
<p>Looks like <code>cargo check</code> tries to check dependencies (<code>quickcheck</code> in particular), and looks like it <em>might</em> be related to build scripts</p>



<a name="186730570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186730570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186730570">(Jan 27 2020 at 21:59)</a>:</h4>
<p>I have a hunch we might be overwhelming the main thread with progress updates, as they get a little spammy when only the current crate is being checked. Cargo reports each crate even if no work is being done for the crate, so we might want to denounce the progress events.<br>
If you can reliably reproduce you can give my cargo-slowdown branch a go and see if the RA_PROFILE numbers say something interesting</p>



<a name="186732304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186732304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186732304">(Jan 27 2020 at 22:19)</a>:</h4>
<p>One thing I noticed is that the "cargo check" message in the status bar might be displayed longer than the time it takes <code>cargo check</code> to run</p>



<a name="186732529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186732529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186732529">(Jan 27 2020 at 22:22)</a>:</h4>
<p>Could the progress notifications be delayed by the other work RA is doing?</p>



<a name="186734617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186734617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186734617">(Jan 27 2020 at 22:50)</a>:</h4>
<p>I don’t think the problem is message flooding, I hunk the problem is<br>
repeatedly re-checking dependencies.</p>



<a name="186734987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186734987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186734987">(Jan 27 2020 at 22:54)</a>:</h4>
<p>It might be a combination of things. I never saw it check too much or not finish at all, but it does appear to take longer than it should</p>



<a name="186735019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186735019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186735019">(Jan 27 2020 at 22:54)</a>:</h4>
<p>Like 2 seconds or so, while <code>cargo check</code> runs instantly</p>



<a name="186735253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186735253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186735253">(Jan 27 2020 at 22:57)</a>:</h4>
<p>Oh</p>



<a name="186735259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186735259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186735259">(Jan 27 2020 at 22:57)</a>:</h4>
<p>It's doing some unbuffered reads</p>



<a name="186735261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186735261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186735261">(Jan 27 2020 at 22:57)</a>:</h4>
<p>Ouch</p>



<a name="186735411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186735411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186735411">(Jan 27 2020 at 22:59)</a>:</h4>
<p><a href="/user_uploads/4715/G7Xt_WDU8-bxot6BtayUDWtX/pasted_image.png" target="_blank" title="pasted_image.png">pasted image</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/G7Xt_WDU8-bxot6BtayUDWtX/pasted_image.png" target="_blank" title="pasted image"><img src="/user_uploads/4715/G7Xt_WDU8-bxot6BtayUDWtX/pasted_image.png"></a></div>



<a name="186735420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186735420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186735420">(Jan 27 2020 at 22:59)</a>:</h4>
<p>It might be the output of <code>cargo metadata</code>, but I'm not sure</p>



<a name="186735426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186735426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186735426">(Jan 27 2020 at 22:59)</a>:</h4>
<p>There's a lot of those</p>



<a name="186735671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186735671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186735671">(Jan 27 2020 at 23:02)</a>:</h4>
<p>Fascinating!</p>



<a name="186735813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186735813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186735813">(Jan 27 2020 at 23:04)</a>:</h4>
<p>TIL pasting a lot of text makes mutter hang</p>



<a name="186736561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186736561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186736561">(Jan 27 2020 at 23:14)</a>:</h4>
<p>Yeah, so that's the pipe with the output of <code>cargo check</code></p>



<a name="186737754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186737754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186737754">(Jan 27 2020 at 23:31)</a>:</h4>
<p>Filed a PR, but it's just as slow as before :(</p>



<a name="186739526"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186739526" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186739526">(Jan 27 2020 at 23:58)</a>:</h4>
<p>Oh, there's a 300 ms timer on the client</p>



<a name="186739533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186739533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186739533">(Jan 27 2020 at 23:58)</a>:</h4>
<p>That's why it seems to take so long <span aria-label="unamused" class="emoji emoji-1f612" role="img" title="unamused">:unamused:</span></p>



<a name="186766931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186766931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186766931">(Jan 28 2020 at 09:48)</a>:</h4>
<blockquote>
<p>I don’t think the problem is message flooding, I hunk the problem is<br>
repeatedly re-checking dependencies.</p>
</blockquote>
<p>Cargo doesn't actually re-check dependencies if they haven't changed, it just reports that the package exists and that's where we are in the progress. It uses the same message format though. But upon closer look it also reports if the package is "fresh", e.g. up to date, so we could probably skip reporting fresh packages. Opening a PR shortly</p>



<a name="186767462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186767462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186767462">(Jan 28 2020 at 09:56)</a>:</h4>
<p>We should also avoid duplicate reports. I didn't notice any difference, but it seems like a good idea to reduce the LSP traffic</p>



<a name="186772625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186772625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186772625">(Jan 28 2020 at 11:12)</a>:</h4>
<p>But I still don't understand why it seems to take longer in Code than from the command line. My test is pressing Ctrl-S without making any changes in a small project with a hefty amount of dependencies.</p>



<a name="186772685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186772685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186772685">(Jan 28 2020 at 11:13)</a>:</h4>
<p>I suspect it's just a display issue (the notifications take too much time to be processed), but it might be worth adding some logging code to be sure.</p>



<a name="186772792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186772792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186772792">(Jan 28 2020 at 11:15)</a>:</h4>
<p>At least it's not burning CPU. <code>htop</code> reports an extra 20 ms of CPU time used by the server when pressing Ctrl-S once.</p>



<a name="186778884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186778884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186778884">(Jan 28 2020 at 12:46)</a>:</h4>
<p><a href="/user_uploads/4715/Ah6gYFz2E4dGXerK9buumCRv/pasted_image.png" target="_blank" title="pasted_image.png">pasted image</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/Ah6gYFz2E4dGXerK9buumCRv/pasted_image.png" target="_blank" title="pasted image"><img src="/user_uploads/4715/Ah6gYFz2E4dGXerK9buumCRv/pasted_image.png"></a></div>



<a name="186778902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186778902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186778902">(Jan 28 2020 at 12:46)</a>:</h4>
<p>looks like we might have more concurrent rustc than we want...</p>



<a name="186779040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186779040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186779040">(Jan 28 2020 at 12:49)</a>:</h4>
<p>Are those two running instances of <code>cargo check</code>?</p>



<a name="186779171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186779171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186779171">(Jan 28 2020 at 12:51)</a>:</h4>
<p>You should make sure to not run it twice -- that can happen if you save twice in a row.</p>



<a name="186779247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186779247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186779247">(Jan 28 2020 at 12:52)</a>:</h4>
<p>I have auto-save on 100ms</p>



<a name="186779332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186779332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186779332">(Jan 28 2020 at 12:53)</a>:</h4>
<p>The code tries to kill the one that's already running, but not too hard</p>



<a name="186779358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186779358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186779358">(Jan 28 2020 at 12:53)</a>:</h4>
<p>So it might spawn another one while it's still running</p>



<a name="186779708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186779708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186779708">(Jan 28 2020 at 12:58)</a>:</h4>
<p>There are some other things that could trigger rebuilding, like different <code>RUSTFLAGS</code>. That can happen if you set them in your <code>.profile</code>, since Code won't read it. Picking the wrong manifest might also explain it, although I didn't see it happen.</p>



<a name="186779914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186779914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186779914">(Jan 28 2020 at 13:01)</a>:</h4>
<p>Maybe we should add a "submit bug report" feature that saves things like the platform, environment variables (for both the server and in a shell), the output of <code>cargo metadata</code> and so on <span aria-label="pensive" class="emoji emoji-1f614" role="img" title="pensive">:pensive:</span>.</p>



<a name="186782343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782343">(Jan 28 2020 at 13:33)</a>:</h4>
<p>could we wait until the canceled one is finished before we start a new check?</p>



<a name="186782474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782474">(Jan 28 2020 at 13:35)</a>:</h4>
<p>for the rebuilding problem, having a different target folder would help, though I really like being able to <code>cargo check</code> on the command line (or using emacs' cargo integration) and getting instant results because it already ran</p>



<a name="186782567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782567">(Jan 28 2020 at 13:36)</a>:</h4>
<p>though admittedly that's kind of a workaround for the fact that I don't get a global error list from the LSP <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> (I think VS Code has that, right?)</p>



<a name="186782629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782629">(Jan 28 2020 at 13:37)</a>:</h4>
<p>The duplicate checks might have to do with the order of drops, give me a minute</p>



<a name="186782698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782698">(Jan 28 2020 at 13:38)</a>:</h4>
<blockquote>
<p>though admittedly that's kind of a workaround for the fact that I don't get a global error list from the LSP</p>
</blockquote>
<p>We actually should move away from a global list for cargo check. Rather, we should only check the crates which are currently opened. Hacking on ra_syntax with cargo check enabled is pretty painful, b/c it rebulids everyhing</p>



<a name="186782711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782711">(Jan 28 2020 at 13:38)</a>:</h4>
<p>but yeah, the core problem is that it <em>does</em> seem to rebuilds the deps in this case</p>



<a name="186782810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782810">(Jan 28 2020 at 13:39)</a>:</h4>
<p>It rebuilds depend<em>ants</em> yes, not dependencies, unless something is wonky with target</p>



<a name="186782885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782885">(Jan 28 2020 at 13:40)</a>:</h4>
<p>e.g the things that depend on the crate you're editing if they're in the same workspace</p>



<a name="186782971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782971">(Jan 28 2020 at 13:41)</a>:</h4>
<p>We could also check only the modified crate, but that's going to miss some errors and, more importantly, it might pick the wrong features and rebuild everything</p>



<a name="186782987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782987">(Jan 28 2020 at 13:41)</a>:</h4>
<p>I ran into that in <a href="https://github.com/rust-analyzer/rust-analyzer/issues/1925" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/1925">https://github.com/rust-analyzer/rust-analyzer/issues/1925</a></p>



<a name="186782994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186782994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186782994">(Jan 28 2020 at 13:41)</a>:</h4>
<p>Ah, ok, there's many test targets in the workspace I am working on, that's why I see a ton of rustc</p>



<a name="186783164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186783164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186783164">(Jan 28 2020 at 13:43)</a>:</h4>
<p>There's definitely something wrong with drop order as well, that results in not waiting for the first check to cancel before starting a new one, going to fix that too</p>



<a name="186783195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186783195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186783195">(Jan 28 2020 at 13:43)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> if are you hacking with <code>ra_syntax</code> now, please let me know...</p>



<a name="186783278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186783278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186783278">(Jan 28 2020 at 13:44)</a>:</h4>
<p>I think <code>self.watcher = WatchThread::new(&amp;self.options, &amp;self.workspace_root);</code> is going to start a new thread without waiting for the previous one</p>



<a name="186783325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186783325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186783325">(Jan 28 2020 at 13:45)</a>:</h4>
<p><span class="user-mention" data-user-id="203546">@Laurențiu Nicola</span> The drop impl cancels the running process and waits for it, <strong>but</strong> it is run after creating the new watch thread, which is an issues resulting in two cargo instances</p>



<a name="186783345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186783345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186783345">(Jan 28 2020 at 13:45)</a>:</h4>
<p><span class="user-mention" data-user-id="258149">@std::Veetaha</span> no, I don't plant to touch ra_syntax in the nearset future</p>



<a name="186783418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186783418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186783418">(Jan 28 2020 at 13:46)</a>:</h4>
<p>Actually the two cargo visible instances might be an artifact of how htop works</p>



<a name="186783469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186783469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186783469">(Jan 28 2020 at 13:46)</a>:</h4>
<blockquote>
<p>Actually the two cargo visible instances might be an artifact of how htop works</p>
</blockquote>
<p>It might just be a second thread yea, but there is a theoretical bug anyways</p>



<a name="186783868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186783868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186783868">(Jan 28 2020 at 13:51)</a>:</h4>
<p>New PR is up for the drop issue</p>



<a name="186784563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186784563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186784563">(Jan 28 2020 at 13:59)</a>:</h4>
<blockquote>
<p>We actually should move away from a global list for cargo check. Rather, we should only check the crates which are currently opened. Hacking on ra_syntax with cargo check enabled is pretty painful, b/c it rebulids everyhing</p>
</blockquote>
<p>sure, I just meant global as in more than just the current file though ;)</p>



<a name="186785175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186785175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186785175">(Jan 28 2020 at 14:05)</a>:</h4>
<p>Yup, things are a little better after <a href="https://github.com/rust-lang/rust/issues/2923" target="_blank" title="https://github.com/rust-lang/rust/issues/2923">#2923</a></p>



<a name="186785483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186785483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186785483">(Jan 28 2020 at 14:08)</a>:</h4>
<p>With regards to checking just the current crate it's a bit of "plague vs cholera": longer check times but error messages when you break something in a consumer crate. It would hurt some of my workflows a bit, but if we added a "run full check" command as well, it wouldn't be too bad</p>



<a name="186785642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186785642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186785642">(Jan 28 2020 at 14:10)</a>:</h4>
<p>Yeah, I think this needs to be configurable. Probably something like:</p>
<ul>
<li>&lt; 10 crates in graph: do full check by default</li>
<li>workspace with &gt; 10 crates total, check current crate by default</li>
<li>
<blockquote>
<p>200 crates: disable cargo check by default, prompt the user</p>
</blockquote>
</li>
</ul>



<a name="186785736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186785736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186785736">(Jan 28 2020 at 14:11)</a>:</h4>
<p>There is some challenge to finding the correct Cargo.toml for a given source file, but that should be solvable.</p>



<a name="186785808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186785808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186785808">(Jan 28 2020 at 14:12)</a>:</h4>
<p><span class="user-mention" data-user-id="212936">@Emil Lauridsen</span> We might also want to use <code>package_id</code> instead of <code>target.name</code>. The first one includes the version (and registry, unfortunately), but works for build scripts. <code>target.name</code> is <code>build-script-build</code> for those.</p>



<a name="186786045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186786045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186786045">(Jan 28 2020 at 14:14)</a>:</h4>
<p>I also made this change:</p>
<div class="codehilite"><pre><span></span>diff --git i/editors/code/src/status_display.ts w/editors/code/src/status_display.ts
index c75fddf9..52f5ce95 100644
--- i/editors/code/src/status_display.ts
+++ w/editors/code/src/status_display.ts
@@ -17,7 +17,7 @@ export function activateStatusDisplay(ctx: Ctx) {
 class StatusDisplay implements vscode.Disposable {
     packageName?: string;

-    private i = 0;
+    private i: number = 0;
     private statusBarItem: vscode.StatusBarItem;
     private command: string;
     private timer?: NodeJS.Timeout;
@@ -37,11 +37,8 @@ class StatusDisplay implements vscode.Disposable {
         this.timer =
             this.timer ||
             setInterval(() =&gt; {
-                if (this.packageName) {
-                    this.statusBarItem!.text = `${this.frame()} cargo ${this.command} [${this.packageName}]`;
-                } else {
-                    this.statusBarItem!.text = `${this.frame()} cargo ${this.command}`;
-                }
+                this.frame();
+                this.refreshText();
             }, 300);

         this.statusBarItem.show();
@@ -65,6 +62,14 @@ class StatusDisplay implements vscode.Disposable {
         this.statusBarItem.dispose();
     }

+    refreshText() {
+        if (this.packageName) {
+            this.statusBarItem!.text = `${spinnerFrames[this.i]} cargo ${this.command} [${this.packageName}]`;
+        } else {
+            this.statusBarItem!.text = `${spinnerFrames[this.i]} cargo ${this.command}`;
+        }
+    }
+
     handleProgressNotification(params: WorkDoneProgressBegin | WorkDoneProgressReport | WorkDoneProgressEnd) {
         switch (params.kind) {
             case &#39;begin&#39;:
@@ -74,6 +79,7 @@ class StatusDisplay implements vscode.Disposable {
             case &#39;report&#39;:
                 if (params.message) {
                     this.packageName = params.message;
+                    this.refreshText();
                 }
                 break;

@@ -84,6 +90,6 @@ class StatusDisplay implements vscode.Disposable {
     }

     private frame() {
-        return spinnerFrames[(this.i = ++this.i % spinnerFrames.length)];
+        this.i = (this.i + 1) % spinnerFrames.length;
     }
 }
</pre></div>


<p>It keeps the spinner refreshing on a timer, but updates the package name when it changes. It feels a bit nicer, but might be slower during the initial analysis.</p>



<a name="186806807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186806807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186806807">(Jan 28 2020 at 17:46)</a>:</h4>
<p>Ah, another issue here is that <code>cargo</code> only tells us when an artifact finishes, not when it starts. So the crate we display in the status bar might be the one that just finished, not the one that's being checked.</p>



<a name="186865159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865159">(Jan 29 2020 at 08:33)</a>:</h4>
<p>FOUND IT!</p>



<a name="186865160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865160">(Jan 29 2020 at 08:33)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/commit/b8245e47e98ee4d287087f10a0d493bdc3964951" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/commit/b8245e47e98ee4d287087f10a0d493bdc3964951">https://github.com/rust-analyzer/rust-analyzer/commit/b8245e47e98ee4d287087f10a0d493bdc3964951</a></p>



<a name="186865166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865166">(Jan 29 2020 at 08:33)</a>:</h4>
<p>we were scheduling diagnostics computation on the main loop</p>



<a name="186865179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865179">(Jan 29 2020 at 08:33)</a>:</h4>
<p>naturally, if the main loop computes diagnostics, there's nothing to cancel it</p>



<a name="186865220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865220">(Jan 29 2020 at 08:34)</a>:</h4>
<blockquote>
<p>we were scheduling diagnostics computation on the main loop</p>
</blockquote>
<p>Oh god. that's horrible</p>



<a name="186865227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865227">(Jan 29 2020 at 08:34)</a>:</h4>
<p>great job finding it</p>



<a name="186865247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865247">(Jan 29 2020 at 08:34)</a>:</h4>
<p>it was actually easy to find, once I've got back to the situation where it's easy to reproduce</p>



<a name="186865280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865280">(Jan 29 2020 at 08:35)</a>:</h4>
<p>basically, </p>
<div class="codehilite"><pre><span></span>fn loop_turn(
    ...
) -&gt; Result&lt;()&gt; {
    eprintln!(&quot;event = {:?}&quot;, event);
    let _p = ra_prof::print_time(&quot;event&quot;);
</pre></div>


<p>was all I used for debugging, the gun was smoking:</p>
<div class="codehilite"><pre><span></span>event = AddDiagnostic(&quot;file:///home/matklad/projects/stdarch/crates/core_arch/src/x86/mod.rs&quot;, DiagnosticWithFixes { diagnostic: Diagnostic { range: Range { start: Position { line: 354, character: 0 }, end: Position { line: 354, character: 56 } }, severity: Some(Error), code: Some(String(&quot;E0545&quot;)), source: Some(&quot;rustc&quot;), message: &quot;incorrect \&#39;issue\&#39;&quot;, related_information: None, tags: None }, suggested_fixes: [] })
event: 933.389429ms
</pre></div>



<a name="186865294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865294">(Jan 29 2020 at 08:35)</a>:</h4>
<p>oh boy</p>



<a name="186865343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865343">(Jan 29 2020 at 08:36)</a>:</h4>
<p>thank god it's something stupid, that's fairly easy to fix</p>



<a name="186865368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865368">(Jan 29 2020 at 08:36)</a>:</h4>
<p>Also, I have a confession to make: I can't use logs for debugging :-(</p>
<p>In theory, one should not recompile the code and just run with appropirate log level and see the problem.</p>
<p>In practice, it is soooo much easier for me to insert a printf than to figure out how to filter out the messages I need</p>



<a name="186865481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Emil Lauridsen <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865481">(Jan 29 2020 at 08:38)</a>:</h4>
<p>I know that feeling very well</p>



<a name="186865508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865508">(Jan 29 2020 at 08:39)</a>:</h4>
<p>Also, we should probably <code>log::error!() if turn_start.elapsed() &gt;= 250ms</code>, I though we were doing that actually</p>



<a name="186865519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865519">(Jan 29 2020 at 08:39)</a>:</h4>
<p>@maklad What is the procedure of your debug steps ? I have the same problem for debug this kind of thing in RA.</p>



<a name="186865585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865585">(Jan 29 2020 at 08:40)</a>:</h4>
<p>One day, we should do <code>if loop_start.elapsed() &gt; 16ms { panic!("zero tolerance for lags") }</code>....</p>



<a name="186865612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186865612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186865612">(Jan 29 2020 at 08:41)</a>:</h4>
<p><span class="user-mention" data-user-id="216201">@Edwin Cheng</span> good question! Let me write this to the <code>docs/dev</code> once I get to work place...</p>



<a name="186867861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186867861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186867861">(Jan 29 2020 at 09:21)</a>:</h4>
<p>Also, let me cc <span class="user-mention" data-user-id="198819">@David Barsky</span> on the <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/cargo.20check.20issue/near/186865368" title="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/cargo.20check.20issue/near/186865368">https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/cargo.20check.20issue/near/186865368</a> and <a href="https://github.com/sebasmagri/env_logger/issues/144" target="_blank" title="https://github.com/sebasmagri/env_logger/issues/144">https://github.com/sebasmagri/env_logger/issues/144</a>, just to plant these ideas into your head for the tracing thing</p>



<a name="186868409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186868409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186868409">(Jan 29 2020 at 09:29)</a>:</h4>
<blockquote>
<p>One day, we should do <code>if loop_start.elapsed() &gt; 16ms { panic!("zero tolerance for lags") }</code>....</p>
</blockquote>
<p>That would be horrible on very slow computers, or if you paused ra for a bit of time during debugging though. It did better be disableable.</p>



<a name="186871738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186871738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186871738">(Jan 29 2020 at 10:16)</a>:</h4>
<p>What about people with 240 Hz displays? <span aria-label="stuck out tongue wink" class="emoji emoji-1f61c" role="img" title="stuck out tongue wink">:stuck_out_tongue_wink:</span>  Oof. I even looked at that code, but thought that "publishing" diagnostics is okay. Actually, I'm not even sure what the problem is.</p>



<a name="186872032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186872032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186872032">(Jan 29 2020 at 10:20)</a>:</h4>
<p><code>handlers::publish_diagnostics</code> also <strong>computes</strong> diagnostics</p>



<a name="186872058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186872058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186872058">(Jan 29 2020 at 10:21)</a>:</h4>
<p>Ah, the <code>Analysis::diagnostics</code> call?</p>



<a name="186872070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186872070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186872070">(Jan 29 2020 at 10:21)</a>:</h4>
<p>yup</p>



<a name="186872095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186872095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186872095">(Jan 29 2020 at 10:22)</a>:</h4>
<p>Yeah, that's.. easy to miss.</p>



<a name="186886572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186886572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186886572">(Jan 29 2020 at 13:47)</a>:</h4>
<p>Dumped my debugging workflows to <a href="https://github.com/rust-analyzer/rust-analyzer/pull/2940#issuecomment-579761669" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/pull/2940#issuecomment-579761669">https://github.com/rust-analyzer/rust-analyzer/pull/2940#issuecomment-579761669</a></p>
<p>Nothing to smart, just stick <code>eprintln</code>s everywhere and either drive through <code>cargo test</code> (good case) or <code>cargo xtask install --server</code> (slow case).</p>



<a name="186888376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186888376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Barsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186888376">(Jan 29 2020 at 14:11)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> yowza! Glad you figured that one out :)! I'm going to cc Eliza on that issue as I think that'd be <em>absolutely</em> up her wheelhouse and the 35 minute compile times she sees on linkerd2-proxy.</p>



<a name="186889078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/cargo%20check%20issue/near/186889078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> David Barsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/cargo.20check.20issue.html#186889078">(Jan 29 2020 at 14:20)</a>:</h4>
<p>For the module/line number filtering: we <em>absolutely</em> have the infrastructure for complex filters (c.f. <a href="https://docs.rs/tracing-subscriber/0.2.0-alpha.4/tracing_subscriber/filter/struct.EnvFilter.html#examples" target="_blank" title="https://docs.rs/tracing-subscriber/0.2.0-alpha.4/tracing_subscriber/filter/struct.EnvFilter.html#examples">https://docs.rs/tracing-subscriber/0.2.0-alpha.4/tracing_subscriber/filter/struct.EnvFilter.html#examples</a>) and support for regexes/line numbers, which is being documented in <a href="https://github.com/tokio-rs/tracing/pull/368/" target="_blank" title="https://github.com/tokio-rs/tracing/pull/368/">https://github.com/tokio-rs/tracing/pull/368/</a>. i'm mostly unsure how that should be hooked up to an IDE.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>